<div id="dialog-imageUploader">
    <!-- /.box-header -->
    <div class="box-body">
        <div class="row" style="border-bottom:1px solid #f4f4f4;">
            <div class="margin pull-right">
                <form action="/admin/picture/add" id="myForm" method="post">
                    <div class="btn btn-success" style="cursor: pointer">本地上传</div>
                    <input type="file" id="file" name="file[]" multiple="multiple" onchange="ajaxForm()"
                           style="margin-top: -30px;width: 82px;height: 34px;opacity: 0;cursor: pointer;"/>
                </form>
            </div>
        </div>
        <div id="records-table"></div>
    </div>
    <!-- /.box-body -->

</div>
<script type="text/javascript">
    $('#dialog-imageUploader .pagination a[href]').attr('onclick', 'tabPage(this)');
</script>


<script>
    var curr_page=1;

    //分页加载函数
    function get_page(page){
        curr_page =page;
        var index = layer.load(0, {time: 5 * 1000}); //显示加载中动画，最多5秒自动关闭


        $.ajax({
            type: "get",
            url: `/admin/picture/gallery_table?page=${page}`,
            // data: {id},
            beforeSend: function (xhr) {
                xhr.setRequestHeader('x-pjax', 'true');
            },
            success: function (data) {
                $('#records-table').html(data);
                layer.close(index); //关闭加载动画
            },
            error: function (xhr) {
                layer.close(index); //关闭加载动画
                layer.msg('通讯失败！请重试！', {icon: 2});
            }
        });
    }

    $( document ).ready(function() {
        get_page(1);
    });
</script>